{% extends "base.html" %}

{% block css %}
<link rel="stylesheet" href="/static/css/admin.css" />
{% endblock %}


{% block nav %}
   <div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
      <div class="container">

        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </a>
        <a class="brand" href="/admin/">Googler Admin</a>
        <div class="nav-collapse">
          <ul class="nav">

            <li class="active"><a href="/admin/">Home</a></li>
          </ul>
        </div>
      </div>
    </div>
  </div>
{% endblock %}



{% block content %}
{% if not oauth_user %}
<div class="alert alert-error">
<strong>Oauth not setup yet!</strong>
<a href="/setup_oauth" class="btn">Launch in incogneto mode</a>
</div>
{% endif %}

<div class="alert">
<strong>System Usage Statistics</strong>

<ul>
{% for description, stat in usage_stats.iteritems %}
  <li>{{ description}} {{stat}}</li>
{% endfor %} 
</ul>
</div>


      <div class="row">
        <div class="span4">
<a class="btn btn-primary" href="/admin/manage_organization?action=add">Create a new campaign</a>

        </div>
      </div>
<br /><br />

 <table class="table">
   <tr>
     <th>Campaigns</th>
     <th>Actions</th>
   </tr>
 {% for organization in org_list %}
 <tr>
     <td>{{organization.name}}</td>
     <td>
       
       <form class="form-inline" action="/admin/manage_organization" method="post" />
<a rel="tooltip" title="View tool from the curators perspective" class="btn" href="/admin/manage_organization?action=view&org_key={{organization.key}}">View Curation Tool</a>
<a data-placement="top" rel="tooltip" title="View JSON output for this campaign" class="btn" href="/api/video/{{organization.key}}">View API Output</a>
       <a class="btn" href="/admin/manage_organization?action=edit&org_key={{organization.key}}">Edit Campaign</a>
         <input type="hidden" value="{{organization.key}}" name="org_key" />
         <input type="hidden" value="toggle_status" name="action" />
       {% if organization.status == "ENABLED" %}
         <input type="hidden" value="DISABLED" name="status" />
         <button class="btn btn-danger" type="submit">Disable</button>
       {% else %}
         <input type="hidden" value="ENABLED" name="status" />
         <button class="btn btn-success" type="submit">Enable</button>
       {% endif %}
       </form>
     </td>
   </tr>
 {% endfor %}
 </table>

{% endblock %}


